package algorithm.sort;

import java.util.Random;

/**
 * @author MAX
 * @version 1.0
 * @description TODO
 * @date 2022/1/22 16:59
 */
public class HeapSortTest {
    public static void main(String[] args) {
        int n = 1000000;
        Random random = new Random();
        Integer[] data = new Integer[n];
        for (int i = 0; i < n; i++) {
            data[i] = random.nextInt(Integer.MAX_VALUE);
        }

        long startTime = System.nanoTime();
        HeapSort.sort(data);
        long endTime = System.nanoTime();
        double time = (endTime - startTime) / 1000000000.0;
        System.out.println("heap sort cost time: " + time  + "s");

    }
}
